package com.nms.util;

import javax.servlet.http.HttpServletRequest;

public class SystemUtil {

	private static SystemUtil util = null;
	private String appBasePath = "/";
	public final static String contentBasePath = "content/";

	static {
		util = new SystemUtil();
	}

	private SystemUtil() {
	}

	public static SystemUtil getInstance() {
		return util;
	}

	public String getProjectDir() {
		return System.getProperty("user.dir");
	}

	public String getAppDir(HttpServletRequest hsr) {
		if (appBasePath.equals("/"))
			appBasePath = hsr.getSession().getServletContext().getRealPath("/");
		return appBasePath;
	}

	public String getAppBasePath() {
		return appBasePath;
	}

	public void setAppBasePath(String appBasePath) {
		this.appBasePath = appBasePath;
	}

	public String getContentPath() {
		return appBasePath + contentBasePath;
	}
}
